package com.sangeng.controller;

import com.sangeng.entity.ResponseResult;
import com.sangeng.entity.User;
import com.sangeng.service.LoginServcie;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author bing_  @create 2022/1/5-12:43
 */
@RestController
public class LoginController {

    @Resource
    private LoginServcie loginServcie;


    /**
     * 登录
     *
     * @param user
     * @return
     */
    @PostMapping("/user/login")
    public ResponseResult login(@RequestBody User user) {
        return loginServcie.login(user);
    }


    /**
     * 退出登录
     * @return
     */
    @GetMapping("/user/logout")
    public ResponseResult logout() {
        return loginServcie.logout();
    }


}
